package com.flyco.modules.stm.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.flyco.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;
import com.flyco.poi.excel.annotation.Excel;

/**
 * @Description: 门店
 * @Author: flyco
 * @Date: 2020-09-18
 * @Version: V1.0
 */
@Data
@TableName("stm_store_info")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "stm_store_info对象", description = "门店")
public class StmStoreInfo {

    /**
     * 商家id-门店编号
     */
    @TableId(type = IdType.INPUT)
    @ApiModelProperty(value = "商家id-门店编号")
    private String id;

    private Integer dpFlag;

    private Long partnerId;

    /**
     * 门店编号
     */
    @Excel(name = "门店编号", width = 15)
    @ApiModelProperty(value = "门店编号")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long storeId;
    /**
     * 上级编号
     */
    @Excel(name = "上级编号", width = 15)
    @ApiModelProperty(value = "上级编号")
    private String parentId;

    private Integer brandCategory;

    @Excel(name = "上级编号", width = 15)
    @ApiModelProperty(value = "上级编号（JX)")
    @JsonSerialize(using = ToStringSerializer.class)
    @TableField(insertStrategy = FieldStrategy.IGNORED, updateStrategy = FieldStrategy.IGNORED)
    private Long parentStoreId;
    /**
     * 门店名称
     */
    @Excel(name = "门店名称", width = 15)
    @ApiModelProperty(value = "门店名称")
    private String name;
    /**
     * 门店图标 url
     */
    @Excel(name = "门店图标 url", width = 15)
    @ApiModelProperty(value = "门店图标 url")
    private String picture;
    /**
     * 门店logo url
     */
    @Excel(name = "门店logo url", width = 15)
    @ApiModelProperty(value = "门店logo url")
    private String logo;
    /**
     * 门店小程序码
     */
    @Excel(name = "门店小程序码", width = 15)
    @ApiModelProperty(value = "门店小程序码")
    private String storeQrCode;
    /**
     * 0-未启用  1营业中
     */
    @Excel(name = "0-未启用  1营业中", width = 15)
    @ApiModelProperty(value = "0-已关闭  9-审核通过  1 待审核   2 审核不通过")
    @Dict(dicCode = "store_status")
    private Integer status;
    /**
     * 省
     */
    @Excel(name = "省", width = 15)
    @ApiModelProperty(value = "省")
    private String province;
    /**
     * 城市
     */
    @Excel(name = "城市", width = 15)
    @ApiModelProperty(value = "城市")
    private String city;
    /**
     * 区县
     */
    @Excel(name = "区县", width = 15)
    @ApiModelProperty(value = "区县")
    private String district;
    /**
     * 省份编号
     */
    @Excel(name = "省份编号", width = 15)
    @ApiModelProperty(value = "省份编号")
    private String provinceCode;
    /**
     * 城市编号
     */
    @Excel(name = "城市编号", width = 15)
    @ApiModelProperty(value = "城市编号")
    private String cityCode;
    /**
     * 区编号
     */
    @Excel(name = "区编号", width = 15)
    @ApiModelProperty(value = "区编号")
    private String districtCode;
    /**
     * 详细地址
     */
    @Excel(name = "详细地址", width = 15)
    @ApiModelProperty(value = "详细地址")
    private String address;

    @ApiModelProperty(value = "SAP编码")
    private String sapAddressCode;

    /**
     * 开始营业时间
     */
    @Excel(name = "开始营业时间", width = 15)
    @ApiModelProperty(value = "开始营业时间")
    private String dayTimeStart;
    /**
     * 结束营业时间
     */
    @Excel(name = "结束营业时间", width = 15)
    @ApiModelProperty(value = "结束营业时间")
    private String dayTimeEnd;
    /**
     * 经度
     */
    @Excel(name = "经度", width = 15)
    @ApiModelProperty(value = "经度")
    private Double longitude;
    /**
     * 纬度
     */
    @Excel(name = "纬度", width = 15)
    @ApiModelProperty(value = "纬度")
    private Double latitude;
    /**
     * 简单介绍
     */
    @Excel(name = "简单介绍", width = 15)
    @ApiModelProperty(value = "简单介绍")
    private String intro;
    /**
     * 联系电话
     */
    @Excel(name = "联系电话", width = 15)
    @ApiModelProperty(value = "联系电话")
    private String phone;
    /**
     * 联系人
     */
    @Excel(name = "联系人", width = 15)
    @ApiModelProperty(value = "联系人")
    private String linkName;
    /**
     * 门店补货天数
     */
    @Excel(name = "门店补货天数", width = 15)
    @ApiModelProperty(value = "门店补货天数")
    private Integer replenishmentDays;
    /**
     * 实体店门店图片url
     */
    @Excel(name = "实体店门店图片url", width = 15)
    @ApiModelProperty(value = "实体店门店图片url")
    private String entityPicture;
    /**
     * 外部编码
     */
    @Excel(name = "外部编码", width = 15)
    @ApiModelProperty(value = "外部编码")
    private String extCode;
    /**
     * 饿了么编码
     */
    @Excel(name = "饿了么编码", width = 15)
    @ApiModelProperty(value = "饿了么编码")
    private String elemeCode;
    /**
     * 门店到期时间
     */
    @Excel(name = "门店到期时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "门店到期时间")
    private Date endTime;
    /**
     * 店铺类型：1-合伙人/供货商 5-组织结构 8-店铺
     */
    @Excel(name = "店铺类型：1-合伙人/供货商 5-组织结构 8-店铺", width = 15)
    @ApiModelProperty(value = "店铺类型：1-合伙人/供货商 5-组织结构 8-店铺")
    @Dict(dicCode = "store_type")
    private Integer storeType;
    /**
     * 经营模式：1-直营 2-加盟
     */
    @Excel(name = "经营模式：1-直营 2-加盟", width = 15)
    @ApiModelProperty(value = "经营模式：1-直营 2-加盟")
    @Dict(dicCode = "join_type")
    private Integer joinType;
    /**
     * 区域隔离分组id
     */
    @Excel(name = "公司代码", width = 15)
    @ApiModelProperty(value = "公司代码")
    private String companyCode;
    /**
     * 区域隔离分组id
     */
    @Excel(name = "区域隔离分组id", width = 15)
    @ApiModelProperty(value = "区域隔离分组id")
    private Long storeGroupId;
    /**
     * 创建人
     */
    @Excel(name = "创建人", width = 15)
    @ApiModelProperty(value = "创建人")
    private String createBy;
    /**
     * 创建时间
     */
    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
    /**
     * 更新人
     */
    @Excel(name = "更新人", width = 15)
    @ApiModelProperty(value = "更新人")
    private String updateBy;
    /**
     * 更新时间
     */
    @Excel(name = "更新时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    @TableField(exist = false)
    private Integer relationStatus;

    /**
     * 销售人员id
     */
    @ApiModelProperty(value = "销售人员id")
    private String saleUserId;

    /**
     * 销售人员名称
     */
    @Excel(name = "销售人员名称", width = 15)
    @ApiModelProperty(value = "销售人员名称")
    private String saleRealName;

    @Excel(name = "经销商分组名称", width = 15)
    @ApiModelProperty(value = "经销商分组名称")
    private String groupName;

    @ApiModelProperty(value = "经销商分组Id")
    private Integer groupId;

    @ApiModelProperty(value = "登录账号")
    private String account;

    private String channelId;

    @TableField(exist = false)
    private String storeIdAndChannelId;

    public String getStoreIdAndChannelId() {
        return this.storeId + "-" + this.channelId;
    }

    @ApiModelProperty(value = "逗号分隔的渠道名称")
    private String channelName;

    @ApiModelProperty(value = "经销商和发货点距离，单位KM")
    private Integer distance;

    @ApiModelProperty(value = "联系电话2")
    private String phone2;

    @ApiModelProperty(value = "镇或街道")
    private String town;

    @ApiModelProperty(value = "镇或街道编号")
    private String townCode;

    @ApiModelProperty(value = "营业执照json对象")
    private String certificateList;

    @ApiModelProperty(value = "客户说明书json对象")
    private String instructionList;

    @ApiModelProperty(value = "审核时间")
    private Date approveTime;

    @ApiModelProperty(value = "审核人")
    private String approveName;

    @ApiModelProperty(value = "审核意见")
    private String approveReason;

    @ApiModelProperty(value = "发票抬头")
    private String invoiceHeader;

    @ApiModelProperty(value = "纳税登记号")
    private String taxRegistrationNumber;

    @ApiModelProperty(value = "开户账号")
    private String accountsBank;

    @ApiModelProperty(value = "银行账号")
    private String bankAccount;

    @ApiModelProperty(value = "开票联系电话")
    private String invoicingPhone;

    @ApiModelProperty(value = "开票通讯地址")
    private String invoicingAddress;

    @ApiModelProperty(value = "统一会信用代码")
    private String uniformSocialCreditCode;

    @ApiModelProperty(value = "授信额度")
    private BigDecimal creditLimit;

    @ApiModelProperty(value = "剩余信用额度")
    private BigDecimal remainCreditLimit;

    @ApiModelProperty(value = "已用信用额度")
    private BigDecimal usedCreditLimit;

    @ApiModelProperty(value = "授信状态")
    @Dict(dicCode = "creditStatus")
    private Integer creditStatus;

    @ApiModelProperty(value = "授信审核备注")
    private String creditApproveReason;

    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "授信审核时间")
    private Date creditApproveTime;

    @ApiModelProperty(value = "授信审核人")
    private String creditApproveName;

    @ApiModelProperty(value = "授信启用状态 0 关闭  1 开启")
    private String creditEnableStatus;

    @ApiModelProperty(value = "销售人员的金蝶number")
    private String saleNumber;

    @TableField(exist = false)
    private StmDealerDiscount dealerDiscount;

    /**
     * 禁用日期
     */
    @Excel(name = "禁用日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "禁用日期")
    private Date disabledTime;

    @Excel(name = "禁用状态：0.否 1.是", width = 15)
    @ApiModelProperty(value = "禁用状态：0.否 1.是")
    @Dict(dicCode = "disabled_status")
    private Integer disabledStatus;
}
